﻿using System.Windows.Forms;
using BasecampRestAPI;
using BasecampUI;
using NUnit.Framework;
using TestBasecampRestAPI.TestMoveToDoList;

namespace TestBasecampRestAPI.TestBasecampUI
{
	[TestFixture]
	public class TestCredentialsFormMediator
	{
		FakeCredentialsForm _form;
		CredentialsFormMediator _mediator;
		FakeCredentialsMainForm _mainForm;
		FakeRestWebService _service;

		[SetUp]
		public void SetUp()
		{
			_form = FakeCredentialsForm.GetInstance();
			_service = FakeRestWebService.GetInstance();
			_form.ServiceGetFakeResult = _service;
			_mediator = CredentialsFormMediator.GetInstance(_form);
			_mainForm = FakeCredentialsMainForm.GetInstance();
			_mainForm.CredentialsFormGetFakeResult = _form;
		}

		[Test]
		public void Construct()
		{
			Assert.IsNotNull(_mediator);
		}

		[Test]
		public void Load()
		{
			_mediator.Load();
			Assert.IsTrue(_form.UrlTextSetCalled);
			Assert.AreEqual(string.Empty, _form.UrlTextSetLastValue);
			Assert.IsTrue(_form.FocusUserNameCalled);
		}
	}
}